﻿<UserControl x:Class="LaunchPad.Core.Controls.LibraryControl"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
             xmlns:lp="clr-namespace:LaunchPad.Core"
             mc:Ignorable="d" 
             d:DesignHeight="300" d:DesignWidth="300">
    <UserControl.Resources>
        <lp:TimeSpanConverter x:Key="timeSpanConverter"/>
    </UserControl.Resources>
    <Grid>
        <!--<DataGrid Name="productDataGrid" ItemsSource="{Binding Source={x:Static lp:ProductFactory.Instance}, Path=Products}" VerticalAlignment="Stretch"-->
        <DataGrid Name="productDataGrid" ItemsSource="{Binding Inventory}" VerticalAlignment="Stretch" 
                  HorizontalAlignment="Stretch" HorizontalContentAlignment="Stretch"
                  MouseLeftButtonDown="ProductDataGridMouseLeftButtonDown"
                  MouseMove="ProductListViewMouseMove" CanUserAddRows="False"
                  AutoGenerateColumns="False" CanUserDeleteRows="True" AlternatingRowBackground="#FFECE9E6" BorderThickness="0" GridLinesVisibility="None" Margin="0,0,0,35">
            <DataGrid.Columns>
                <DataGridTemplateColumn>
                    <DataGridTemplateColumn.CellTemplate>
                        <DataTemplate>
                            <Button Name="propertyButton" ToolTip="Properties" Click="PropertyButtonClick">
                                <Button.Content>
                                    <Image Source="Images/product_info.png" />
                                </Button.Content>
                            </Button>
                        </DataTemplate>
                    </DataGridTemplateColumn.CellTemplate>
                </DataGridTemplateColumn>
                <DataGridTextColumn Header="Name" FontWeight="Bold" Binding="{Binding Path=Product.Name}" Width="*" FontSize="16"  IsReadOnly="True"/>
                <DataGridTextColumn Header="Lead In" Binding="{Binding Path=Product.LeadIn, ConverterParameter=mm:ss.f, Converter={StaticResource timeSpanConverter}}" Width="Auto" IsReadOnly="True"/>
                <DataGridTextColumn Header="Lead Out" Binding="{Binding Path=Product.LeadOut, ConverterParameter=mm:ss.f, Converter={StaticResource timeSpanConverter}}" Width="Auto" IsReadOnly="True"/>
                <DataGridTextColumn Header="Inventory" Binding="{Binding Path=Total}"/>
                <DataGridTextColumn Header="In Show" Binding="{Binding Path=InShow}" IsReadOnly="True"/>
                <!--<DataGridTextColumn Header="Max Uses" Binding="{Binding MaxUses}" Width="Auto"/>
                <DataGridTextColumn Header="Time To Reset" Binding="{Binding TimeToReset}" Width="Auto"/>-->
           
            </DataGrid.Columns>
        </DataGrid>
        <Button HorizontalAlignment="Right" Margin="0,0,6,6" Name="addProductButton" VerticalAlignment="Bottom" Click="AddProductButtonClick" >
            <Button.Content>
                <StackPanel Orientation="Horizontal">
                    <Image Source="Images/product_add.png" Stretch="None" />
                    <TextBlock Text="Add Product" Margin="5,0,0,0"/>
                </StackPanel>
            </Button.Content>
        </Button>
    </Grid>
</UserControl>
